import 'package:flutter/material.dart';

void main() {
  runApp(MainPage());
}
class MainPage extends StatelessWidget{
  const MainPage({Key? key}) : super(key: key);
  List<Widget> getList(){
    return List.generate(10,(index){
      return Container(
        width:100,
        height:100,
        color: Colors.primaries[index],
      );
    });
    
  }
  @override
  Widget build(BuildContext context){
    return MaterialApp(
      home:Scaffold(
        body:Container(
          height: MediaQuery.of(context).size.height,
          width: MediaQuery.of(context).size.width,
          decoration: BoxDecoration(
            color: Colors.grey,
          ),
          child:Wrap(
            direction:Axis.horizontal,
            alignment:WrapAlignment.center,
            spacing:10,
            runSpacing:10,
            children:[
              Container(
                width:100,
                height:100,
                color: Colors.blue,
              ),
              Container(
                width:100,
                height:100,
                color: Colors.red,
              ),
              Container(
                width:100,
                height:100,
                color: Colors.green,
              ),
              ...getList()
            ]
          )
        )
        )
    );
  }
}